Class: models/Graph

models/Graph

new models/Graph()

图结构
Source:

Extends

  • Backbone.Model

Methods

addEdge(edge)

添加边
Parameters:
Name Type Description
edge Edge 新边
Source:

addNode(node)

添加节点
Parameters:
Name Type Description
node Node 新节点
Source:

getEdgeArray() → {Array.<Edge>}

生成所有可用Edge的数组。在lazy模式下,会屏蔽所有已删除的边。
Source:
Returns:
Type
Array.<Edge>

getEdgeById(edgeId) → {Edge|undefined}

根据id号查询Edge。
Parameters:
Name Type Description
edgeId
Source:
Returns:
Type
Edge | undefined

getEdgeProperties() → {Array.<string>}

返回边的可用属性
Source:
Returns:
Type
Array.<string>

getNeighbors(node, direction) → {array}

查找邻居
Parameters:
Name Type Description
node Node 节点id号,或Node的引用。
direction string 指定方向,为Graph.Direction中的一个值。
Source:
Returns:
Node和Edge的数组。
Type
array

getNodeArray() → {Array.<Node>}

生成所有可用Node的数组。在lazy模式下,会屏蔽所有已删除的节点。
Source:
Returns:
Type
Array.<Node>

getNodeById(nodeId) → {Node|undefined}

根据id号查询Node。
Parameters:
Name Type Description
nodeId
Source:
Returns:
Type
Node | undefined

getNodeByProperty(filterOptions) → {Array.<Node>}

通过设置过滤器来查找节点
Parameters:
Name Type Description
filterOptions 过滤参数
Source:
Returns:
查找到的节点数组
Type
Array.<Node>

getNodeProperties() → {Array.<string>}

返回节点的可用属性
Source:
Returns:
Type
Array.<string>

getType() → {String}

返回网络类型,为Graph.Type中的一种
Source:
Returns:
Graph的类型
Type
String

hasServerSideLayout() → {boolean}

返回是否填充过后端布局数据。
Source:
Returns:
Type
boolean

isEgoNetwork() → {boolean}

判断是否为Ego网络
Source:
Returns:
Type
boolean

layout(options)

重新计算Node的位置。
Parameters:
Name Type Description
options object 与图类型相对应的视觉参数
Source: